home *** CD-ROM | disk | FTP | other *** search
/ Archive Magazine CD 1995 / Archive Magazine CD 1995.iso / discs / prog_disc / volume_8 / issue_07 / keystroke / Just < prev    next >
Encoding:
Text File  |  1995-02-27  |  5.9 KB  |  140 lines

  1. The text that follows describes how to set Keystroke to perform a routine for the stripping out of 
  2. carriage returns from preformatted text as requested by Archive reader Stuart Bell.
  3.  
  4. The series of actions we need to tell Keystroke to get Edit to perform is to convert all double CRs 
  5. (Carriage Returns) to ZXZ, then convert all remaining single CRs to a single space, any double 
  6. spaces are then converted to a single space, then finally convert all ZXZ letter groups back to CRs 
  7. again.
  8.  
  9. The text we are going to convert in this example is the !Help text file that is held within your 
  10. !System application. Open your copy of !System and backup this file before we start tampering with 
  11. it!
  12. Load the text file into your copy of !Edit and look at it. The text is preformatted at 50 characters a 
  13. line which is fine for reading in a text editor, but not so good for using within a word or DTP 
  14. processor.
  15.  
  16. I've assumed at this point that you have the text file in Edit, and you have a copy of Keystroke 
  17. loaded ready for setting up.
  18.  
  19. First choose a key combination to activate the actions that Keystroke will be asked to perform.
  20. I have chosen Alt+Q for this example.
  21.  
  22. Action 1
  23. Key : Alt+ Q
  24. Keystroke type:    Insert text
  25. Text:        \C-⇧\\F4\
  26. This action will force the caret within Edit to the top left and then pop up its Find text window.
  27. The reason for moving the caret is that Edit only performs its search & replace operations from the 
  28. caret position. By forcing it to the beginning we can be certain it will operate on all the text.
  29.  
  30. Action 2
  31. Key : Alt+Q
  32. Keystroke type:    Icon click
  33. Window option:    Any window
  34. Match option:        Must match details
  35. Click type:        Select, Single, Switch On
  36. Drag to set:        The 'Magic characters' icon in the 'Find text' window of 
  37. Edit
  38.         Note : You'll need to use the two shift keys to set Keystroke.
  39. Link :        On
  40. This action performs a single Select type mouse click on the icon called 'Magic characters' held 
  41. within Edit's find text window and forces it to be switched on.
  42. (Normally you drag the 'Drag to set' icon from Keystroke to the icon or window concerned. But 
  43. these particular Edit windows will close immediately if you try this, so use Keystrokes alternative 
  44. way of setting it by positioning the mouse pointer to the icon in Edit and press the two shift keys at 
  45. the same time.)
  46.  
  47. Action 3
  48. Key : Alt+Q
  49. Keystroke type:    Insert text
  50. Text:    \\n\\n\⇩\ZXZ|M
  51. Link :         On
  52. This action enters '\n\n' within the Find: box. This is the required two CRs. Then \⇩\ which is a 
  53. cursor down command. The caret is now in the 'Replace with: box, so Keystroke now enters 'ZXZ' 
  54. followed by a '|M' which starts the search and replace operation off.
  55.  
  56. Action 4
  57. Key : Alt+Q
  58. Keystroke type:    Icon click
  59. Window option:    Any window
  60. Match option:        Must match details
  61. Drag to set:        On the 'End of File replace' icon in the 'Text found:' 
  62. window
  63.         Note : You'll need to use the two shift keys to set Keystroke.
  64. Click type:        Select, Single, Toggle
  65. Link :        On
  66. This action will click on the End of File replace icon to perform the search and replace on ALL 
  67. occurrences  found. ( Risc PC owners and users of !Newlook will find that this window is named 
  68. 'Text found')
  69.  
  70. Action 5
  71. Key : Alt+Q
  72. Keystroke type:    Insert text
  73. Text:        |[\C-⇧\\F4\\\n\⇩\ |M
  74. Link :        On
  75. This action first closes the 'Text found: window by simulating an 'Escape' key being pressed (|[), 
  76. then as before the cursor is placed back to the beginning of the text and the 'find text' window 
  77. popped up by 'F4'.
  78. A CR, '\n', is entered in the 'Find' box and a single space is entered in the 'Replace with:' box and 
  79. the '|M' sets the search and replace off.
  80.  
  81. Action 6
  82. The same as Action 4. 
  83. This action will click on the 'End of file replace' icon to perform the search and replace on ALL 
  84. occurrences  found. 
  85.  
  86. Action 7
  87. Key : Alt+Q
  88. Keystroke type:    Insert text
  89. Text:        |[\C-⇧\\F4\  \⇩\ |M
  90. Link :        On
  91. As before the 'Text found: window is closed by simulating an 'Escape' key being pressed (|[), then 
  92. the cursor is placed back to the beginning of the text and the 'find text' window popped up by 'F4'.
  93. This time a double space is entered in the 'Find' box and a single space is entered in the 'Replace 
  94. with:' box and the '|M' sets the search and replace off.
  95.  
  96. Action 8
  97. The same as Action 4.
  98. This action will click on the 'End of file replace' icon to perform the search and replace on ALL 
  99. occurrences  found. 
  100.  
  101. Action 9
  102. Key : Alt+Q
  103. Keystroke type:    Insert text
  104. Text:        |[\C-⇧\\F4\ZXZ\⇩\\\n|M
  105. Link :        On
  106. As before the 'Text found: window is closed by simulating an 'Escape' key being pressed (|[), then 
  107. the cursor is placed back to the beginning of the text and the 'find text' window popped up by 'F4'.
  108. This time the letters 'ZXZ' are entered in the 'Find' box and a single '\n' (CR) is entered in the 
  109. 'Replace with:' box and the '|M' sets the search and replace off.
  110.  
  111. Action 10
  112. The same as Action 4.
  113. This action will click on the 'End of file replace' icon to perform the search and replace on ALL 
  114. occurrences  found.
  115.  
  116. Action 11
  117. Key : Alt+Q
  118. Keystroke type:    Insert text
  119. Text:        |[\F3\
  120. Link :        On
  121. The 'Text found:' window is closed once again (|[) and the text has now been de-formatted, ready 
  122. to save. So '\F3\' performs a F3 command and up pops Edit's Save dialogue window!
  123.  
  124. Last point.
  125. You will have noticed that the Link option has been set on for each action. The reason for this is that 
  126. if one individual action did fail to operate for some reason (perhaps the user had accidentally closed 
  127. the Edit text window) then the whole sequence will stop. The individual actions having been 'linked' 
  128. together as one whole group.
  129.  
  130. Owners of Keystroke should examine their keystrokes Archive directory that we supply with 
  131. Keystroke. Within it you'll find a directory called 'RetrnStrip'. This provides a  bigger and better 
  132. example of this type of search and replace operation with Edit.
  133.  
  134.  
  135. By Stuart Halliday
  136.  
  137.  
  138.  
  139. © Quantum Software 1995
  140.